<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <h1>ces </h1>

  <script>
    const a= [{item1:305},{item2:306},{item1:1},{item2:2}];
    // [{item1: [305, 1]},{item2:[306, 2]}]
   let Arr =  a.reduce((arrItem,value)=>{
      const aKey=Object.keys(value)[0]
      let  ArrIndex = null
       const filterarr = arrItem.filter((Iitem,Iindex)=>{
        if(Object.keys(Iitem)[0] ===aKey){
          ArrIndex = Iindex
          return true
        }
       })
        if(filterarr.length===0){
          arrItem.push({[aKey]:[value[aKey]]})
          return arrItem
        }else if(filterarr.length>0){
          arrItem[ArrIndex][aKey].push(value[aKey])
         return arrItem
        }
    },[])
    console.log("arr",Arr );
  </script>
</body>
</html>